package com.example.enumdemo;

/**
 * 目标：认识枚举类，搞清楚其本质特点。
 */
public class Test {
    public static void main(String[] args) {
        A a1 = A.X;
        System.out.println(a1);

        A a2 = A.Y;
        System.out.println(a2);

        System.out.println(a1.name()); // X
        System.out.println(a2.name()); // Y
        System.out.println(a1.ordinal()); // ordinal()是获取索引  0
        System.out.println(a2.ordinal()); // ordinal()是获取索引  1
    }
}
